package yxy.cherry.chat;

import java.io.File;

import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import yxy.cherry.chat.Configuration.HTTPServerClass;

public class HttpServerInitializer {

	protected SslContext provideSslContext() throws Exception {
		HTTPServerClass portal = Configuration.shared().HTTPServer;
		if (portal != null && portal.SSL != null && portal.SSL.Enabled) {
			SslContext ssl = SslContextBuilder.forServer(new File(portal.SSL.CertificateFilename), new File(portal.SSL.PublicKeyFilename)).build();
			return ssl;
		} else {
			return null;
		}
	}

}
